<template>
    <div class="add-paper-dialog">
      <el-bottom-button-dialog v-model="visible" v-bind="$attrs" width="20%" @on-confirm="confirm">
        <div slot="title">
          <h1 class="text-center font-lg">创建考试</h1>
        </div>
        <div style="padding:0 30px 0 30px">
          <el-form label-position="left" label-width="80px">
            <el-form-item label="考试名称" align="left">
              <el-input placeholder="请输入考试名称" v-model="name"></el-input>
            </el-form-item>
<!--            <el-form-item label="组卷方式" align="left">-->
<!--              <el-radio-group v-model="organizeType">-->
<!--                <el-radio-button label="选题组卷">选题组卷</el-radio-button>-->
<!--                <el-radio-button label="抽题组卷">抽题组卷</el-radio-button>-->
<!--              </el-radio-group>-->
<!--            </el-form-item>-->
<!--            <el-form-item label="答题时长" align="left">-->
<!--              <el-radio-group v-model="timeType">-->
<!--                <el-radio-button label="1">整卷限制时长</el-radio-button>-->
<!--                <el-radio-button label="2">单题限制时长</el-radio-button>-->
<!--              </el-radio-group>-->
<!--            </el-form-item>-->
          </el-form>
        </div>
      </el-bottom-button-dialog>
    </div>
</template>

<script>
import ElBottomButtonDialog from '../../../Common/ElBottomButtonDialog'
import __ from 'lodash'
export default {
  inheritAttrs: false,
  mounted () {
    this.$bus.$on('show-add-paper-dialog', () => {
      this.visible = true
    })
  },
  data () {
    return {
      visible: false,
      // timeType: '',
      // organizeType: '',
      name: ''
    }
  },
  components: {
    ElBottomButtonDialog
  },
  methods: {
    confirm () {
      if (__.isEmpty(this.name)) {
        this.$message.error('请填写试卷名称!')
        return
      }

      // if (__.isEmpty(this.timeType)) {
      //   this.$message.error('未选择答题时长!')
      //   return
      // }
      //
      // if (__.isEmpty(this.organizeType)) {
      //   this.$message.error('请填写组织方式!')
      //   return
      // }
      let contest = {
        name: this.name
      }
      this.$store.commit('paper/setContest', contest)
      console.log("hello")
      this.visible = false
      // 开启创建考试流程
      this.$router.push({
        name: 'addPaper'
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
